<?php

class addcust extends AuthenticatedPage
{	  
	var $body_tpl = "page_templates/addcust.tpl";
	
  	
	function page_do()
	{
		parent::page_do();
		global $config;
		   		   
	
		if (@$_REQUEST['submit'] == "Add")
		{
			$name = @$_REQUEST['name'];
			if (strlen($name) != 0)
			{
			
				Ice_loadProfile();
				global $ICE;

				$proxy = $ICE->stringToProxy($config['CS430 Integration']['crm orb locator']);

				$crm = $proxy->ice_checkedCast("::CustomerRelationsManagement::CRM");
				$cust = $crm->CreateCustomer();
				$cust->setName($name);
				$cust->save();
				@$this->body->assign_var('MSG', "<b>Customer Added Succesfully</b><br>Customer ID is: " . $cust->getId() . "<br><br>");
			}
		}
				
	}	  
}

?>